#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>

struct args
{
    /* data */
    int a;
    int b;
    int c;
};


#define CMD_TEST0 _IO('L',0)
#define CMD_TEST1 _IOW('L',1,int)
#define CMD_TEST2 _IOR('L',2,int)




int main(int argc,char *argv[]){
    struct args test_args;
    test_args.a = 1;
    test_args.b = 2;
    test_args.c = 3;
    int fd;

    unsigned int ret = 0;
    fd = open("/dev/test_dev",O_RDWR);
    if(fd < 0){
        perror("open error \n");
        return fd;
    }
    int val;
    while(1){
        ioctl(fd,CMD_TEST0);

        ioctl(fd,CMD_TEST1,&test_args);
 
        ioctl(fd,CMD_TEST2,&val);
        printf("the val this is %d\n",val);
        sleep(1);
    }
    close(fd);

    return 0;



}